import os
from multiprocessing import Process, Manager
import numpy as np
import signal
import time
from itertools import product
import subprocess

# parameter analysis for SAGloss

import tool

# p_list = [10, 15, 20, 25, 30, 35, 40, 45]
# # p_list = [10]
# lr_list = [1e-3, 1e-2]
# v_list = [0.0001, 0.001, 0.01]
# quite_lists = [1]
r_e_list = [1.0]
r_p_list = [0.1, 1, 10, 100,]
# r_p_list = [ 0.3, 0.4, 0.5, 0.6, 0.7]
enlarge_list = [1.1, 1.2, 1.4,]
perplexity_list = [10, 70, 90, 100, 150, 200]
embdim_list = [10, 20, 40, 80, 100, 200, 400]
v_list = [0.001, 0.01, 0.1, 1]
# sigmaP_list = [0.00001, 0.0001, 0.001, 0.01, 0.1, 1, 10, 100]
# augNearRate_list = [1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8]
# sigmaQ_list = [0.1, 0.2, 0.5, 1]
# priori_method_list = ['eye', 'one']
# num_aug_list = [1, 2]
# Netarch_list = ['resnet18', 'resnet50']
# resizeto_list = [96, 225]

cudalist = [
    # 3,
    # 0,
    # 1,
    # 0,
    # 1,
    2,
    3,
    4,
    5,
    # 6,
    # 7,
]

changeList = [v_list,embdim_list, perplexity_list, enlarge_list, r_e_list, r_p_list]
paramName = ['v', 'embdim', 'perplexity', 'enlarge', "r_e", "r_p", ]
mainFunc = "./main_graph2.py"
ater = tool.AutoTrainer(
    changeList,
    paramName,
    mainFunc,
    deviceList=cudalist,
    poolNumber=3*len(cudalist),
    name="autotrain",
    waittime=30,
)
ater.Run()
